package com.buba.springcloud.service.impl;

import com.buba.springcloud.dao.OrderFoodDao;
import com.buba.springcloud.entities.HfFoods;
import com.buba.springcloud.pojo.Foods;
import com.buba.springcloud.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderFoodDao orderFoodDao;
    @Override
    public List<HfFoods> findOrderFoods(List<Foods> foods) {
        ArrayList<HfFoods> hfFoods = new ArrayList<>();
        for (Foods food : foods) {
            HfFoods foodIInfo = orderFoodDao.findFoodInfoi(food.getId());
            foodIInfo.setFoodNum(food.getFoodNum());
            hfFoods.add(foodIInfo);
        }
        return hfFoods;
    }
}
